Dynamic languages, such as JavaScript, Ruby, Python, Perl, and PHP, etc. are increasingly being considered as a replacement for static languages, such as C and C++. Dynamic languages bring benefits such as programmer productivity and a relatively shallow learning curve. However, an obstacle to further adoption of dynamic languages—including JavaScript, Ruby, Python, and others—is the lack of a high-performance shared-memory concurrency mechanism, such as threads and locks, or libdispatch, which are trivially available in static languages. This problem is considered hard, and thus far unsolved, due to how objects work in dynamic languages.
Previous attempts to tackle this problem involved adding locking mechanisms around each object access. While the locking mechanism could ensure the desired concurrency semantics, it is terribly slow. Locking and unlocking may be performed in an order of magnitude slower than a normal heap access, and hence introduce prohibitive overheads.
Additionally, inline cache (IC) is often used in high-performance implementations of JavaScript based code. Typically, inline cache includes self-modifying code. However, concurrent self modifying code that could execute on multiple processors may be both hard and slow. Thus, adding concurrency to inline cache based implementation for JavaScript based code may be impractically expensive.
Further, JavaScript as a language allows for elements to be added to objects after those objects have already been constructed. If a JavaScript based program is executed to add more properties to an object than can be contained in its inline property storage, then a separate out-of-line chunk of memory must be allocated to store its additional properties. JavaScript Arrays are primarily used for indexed property storage. The presence of indexed properties on an object always requires allocation of an out-of-line index property storage object.
Therefore, existing implementations for executing dynamic language based programs tend to lack efficiency, concurrency and effective optimizations.